/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package de.hsmannheim.pepa.patientenportal.apanwep.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.json.JSON;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;

import de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjects;
import de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjectsModel;
import de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjectsSoap;
import de.hsmannheim.pepa.patientenportal.apanwep.service.persistence.messages_mobjectsPK;

import java.io.Serializable;

import java.sql.Types;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * The base model implementation for the messages_mobjects service. Represents a row in the &quot;messages_mobjects&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjectsModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link messages_mobjectsImpl}.
 * </p>
 *
 * @author Cedric Nana
 * @see messages_mobjectsImpl
 * @see de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjects
 * @see de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjectsModel
 * @generated
 */
@JSON(strict = true)
public class messages_mobjectsModelImpl extends BaseModelImpl<messages_mobjects>
	implements messages_mobjectsModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a messages_mobjects model instance should use the {@link de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjects} interface instead.
	 */
	public static final String TABLE_NAME = "messages_mobjects";
	public static final Object[][] TABLE_COLUMNS = {
			{ "messages_ID", Types.BIGINT },
			{ "messageobjects_id", Types.BIGINT }
		};
	public static final String TABLE_SQL_CREATE = "create table messages_mobjects (messages_ID LONG not null,messageobjects_id LONG not null,primary key (messages_ID, messageobjects_id))";
	public static final String TABLE_SQL_DROP = "drop table messages_mobjects";
	public static final String ORDER_BY_JPQL = " ORDER BY messages_mobjects.id.messages_ID ASC, messages_mobjects.id.messageobjects_id ASC";
	public static final String ORDER_BY_SQL = " ORDER BY messages_mobjects.messages_ID ASC, messages_mobjects.messageobjects_id ASC";
	public static final String DATA_SOURCE = "myDataSource";
	public static final String SESSION_FACTORY = "mySessionFactory";
	public static final String TX_MANAGER = "myTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjects"),
			false);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjects"),
			false);
	public static final boolean COLUMN_BITMASK_ENABLED = false;

	/**
	 * Converts the soap model instance into a normal model instance.
	 *
	 * @param soapModel the soap model instance to convert
	 * @return the normal model instance
	 */
	public static messages_mobjects toModel(messages_mobjectsSoap soapModel) {
		if (soapModel == null) {
			return null;
		}

		messages_mobjects model = new messages_mobjectsImpl();

		model.setMessages_ID(soapModel.getMessages_ID());
		model.setMessageobjects_id(soapModel.getMessageobjects_id());

		return model;
	}

	/**
	 * Converts the soap model instances into normal model instances.
	 *
	 * @param soapModels the soap model instances to convert
	 * @return the normal model instances
	 */
	public static List<messages_mobjects> toModels(
		messages_mobjectsSoap[] soapModels) {
		if (soapModels == null) {
			return null;
		}

		List<messages_mobjects> models = new ArrayList<messages_mobjects>(soapModels.length);

		for (messages_mobjectsSoap soapModel : soapModels) {
			models.add(toModel(soapModel));
		}

		return models;
	}

	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjects"));

	public messages_mobjectsModelImpl() {
	}

	@Override
	public messages_mobjectsPK getPrimaryKey() {
		return new messages_mobjectsPK(_messages_ID, _messageobjects_id);
	}

	@Override
	public void setPrimaryKey(messages_mobjectsPK primaryKey) {
		setMessages_ID(primaryKey.messages_ID);
		setMessageobjects_id(primaryKey.messageobjects_id);
	}

	@Override
	public Serializable getPrimaryKeyObj() {
		return new messages_mobjectsPK(_messages_ID, _messageobjects_id);
	}

	@Override
	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey((messages_mobjectsPK)primaryKeyObj);
	}

	@Override
	public Class<?> getModelClass() {
		return messages_mobjects.class;
	}

	@Override
	public String getModelClassName() {
		return messages_mobjects.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("messages_ID", getMessages_ID());
		attributes.put("messageobjects_id", getMessageobjects_id());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long messages_ID = (Long)attributes.get("messages_ID");

		if (messages_ID != null) {
			setMessages_ID(messages_ID);
		}

		Long messageobjects_id = (Long)attributes.get("messageobjects_id");

		if (messageobjects_id != null) {
			setMessageobjects_id(messageobjects_id);
		}
	}

	@JSON
	@Override
	public long getMessages_ID() {
		return _messages_ID;
	}

	@Override
	public void setMessages_ID(long messages_ID) {
		_messages_ID = messages_ID;
	}

	@JSON
	@Override
	public long getMessageobjects_id() {
		return _messageobjects_id;
	}

	@Override
	public void setMessageobjects_id(long messageobjects_id) {
		_messageobjects_id = messageobjects_id;
	}

	@Override
	public messages_mobjects toEscapedModel() {
		if (_escapedModel == null) {
			_escapedModel = (messages_mobjects)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
		}

		return _escapedModel;
	}

	@Override
	public Object clone() {
		messages_mobjectsImpl messages_mobjectsImpl = new messages_mobjectsImpl();

		messages_mobjectsImpl.setMessages_ID(getMessages_ID());
		messages_mobjectsImpl.setMessageobjects_id(getMessageobjects_id());

		messages_mobjectsImpl.resetOriginalValues();

		return messages_mobjectsImpl;
	}

	@Override
	public int compareTo(messages_mobjects messages_mobjects) {
		messages_mobjectsPK primaryKey = messages_mobjects.getPrimaryKey();

		return getPrimaryKey().compareTo(primaryKey);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}

		if (!(obj instanceof messages_mobjects)) {
			return false;
		}

		messages_mobjects messages_mobjects = (messages_mobjects)obj;

		messages_mobjectsPK primaryKey = messages_mobjects.getPrimaryKey();

		if (getPrimaryKey().equals(primaryKey)) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return getPrimaryKey().hashCode();
	}

	@Override
	public void resetOriginalValues() {
	}

	@Override
	public CacheModel<messages_mobjects> toCacheModel() {
		messages_mobjectsCacheModel messages_mobjectsCacheModel = new messages_mobjectsCacheModel();

		messages_mobjectsCacheModel.messages_ID = getMessages_ID();

		messages_mobjectsCacheModel.messageobjects_id = getMessageobjects_id();

		return messages_mobjectsCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(5);

		sb.append("{messages_ID=");
		sb.append(getMessages_ID());
		sb.append(", messageobjects_id=");
		sb.append(getMessageobjects_id());
		sb.append("}");

		return sb.toString();
	}

	@Override
	public String toXmlString() {
		StringBundler sb = new StringBundler(10);

		sb.append("<model><model-name>");
		sb.append(
			"de.hsmannheim.pepa.patientenportal.apanwep.model.messages_mobjects");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>messages_ID</column-name><column-value><![CDATA[");
		sb.append(getMessages_ID());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>messageobjects_id</column-name><column-value><![CDATA[");
		sb.append(getMessageobjects_id());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = messages_mobjects.class.getClassLoader();
	private static Class<?>[] _escapedModelInterfaces = new Class[] {
			messages_mobjects.class
		};
	private long _messages_ID;
	private long _messageobjects_id;
	private messages_mobjects _escapedModel;
}